<?php 
namespace Admin\Controller;

class TestController extends CommonController
{
    public function getTest()
    {

        $cid=1100;
        $tm=time();

        $str=md5($tm.'jdgldd102ssssss'.'yibmnt1511770872'.$cid);

        $url = "http://vip.vcdes.com/index.php?g=Webs&m=Vdingdan&a=index&token=yibmnt1511770872&cid=$cid&str=$str&tm=$tm&st[]=".strtotime('-30 day')."&st[]=".strtotime('+30 day')."";

        $result = $this->http_request($url); //获取源数据
        // $result = mb_substr($result, 5);   //去除源数据的<pre>标签
        echo "<pre>";
        $data = json_decode($result, true); //转数组

        foreach ($data as $key => &$value) {
            $value['info'] = unserialize($value['info']);  //把菜谱反序列化回来成数组
        }
        print_r($data);
        die;
    }

    public function http_request($url, $data = null)
     {
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $url);
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
         if (!empty($data)) {
             curl_setopt($curl, CURLOPT_POST, 1);
             curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
         }
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         $info = curl_exec($curl);
         curl_close($curl);
         return $info;
     }



}